<?php if ( $wp_query->have_posts() ) : ?>

    <div id="loop" class="<?php if ($_COOKIE['mode'] == 'grid') echo 'grid'; else echo 'list'; ?> clear">

    <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

        <div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
            <?php if ( has_post_thumbnail() ) :?>
            <a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
                        'alt'	=> trim(strip_tags( $post->post_title )),
                        'title'	=> trim(strip_tags( $post->post_title )),
                    )); ?></a>
            <?php endif; ?>

            <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

            <div class="post-meta">            
            <p><?php echo __('Phone:  ','free').get_post_meta($post->ID, 'dl_bi_company_phone', true); ?></p>
            <p><?php echo __('Street:  ','free').get_post_meta($post->ID, 'dl_bi_company_street', true); ?></p>
            <p><?php //echo __('Location:  ','free').get_the_term_list($post->ID, 'location', '','->',''); 
            $_terms = wp_get_object_terms($post->ID, 'location', array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'names'));
            echo __('Location:  ','free').implode(">>", $_terms);
            ?></p>
            
            <p><?php //echo __('Location:  ','free').get_the_term_list($post->ID, 'location', '','->',''); 
            $_terms = wp_get_object_terms($post->ID, 'business_category', array('orderby' => 'count', 'order' => 'DESC', 'fields' => 'names'));
            echo __('Category:  ','free').implode(">>", $_terms);
            ?></p>
            
            <p>
            <?php 
            echo __('Location:  ','free').get_the_term_list($post->ID, 'location', '','->',''); 
            echo __('Business:  ','free').get_the_term_list($post->ID, 'business_category', '','->',''); 
            
            ?>
            </p>       
			</div>            
        </div>

    <?php endwhile; 
    //wp_reset_postdata();
    ?>

    </div>

<?php endif; ?>
